package Jasper.service.impl;

import Jasper.dao.IProductDao;
import Jasper.dao.impl.ProductDaoImpl;
import Jasper.entity.Page;
import Jasper.entity.Pro_Class;
import Jasper.entity.Product;
import Jasper.entity.Type;
import Jasper.service.IProductService;

import java.util.List;

/**
 * @ClassName ProductServiceImpl
 * @Author jiangjiajia
 * @JDK-Version 1.8
 * @Date 2021/6/2 9:14 pm
 * @Version 1.0
 * @Description Product的逻辑处理层
 **/
public class ProductServiceImpl implements IProductService {

    private IProductDao productDao = new ProductDaoImpl();

    @Override
    public Page getPage(int currentPage) {
        return null;
    }

    /**
     * 查询所有信息
     *
     * @return
     */
    @Override
    public List<Product> getproductlist() {
        List<Product> list = productDao.getproductlist();
        return list;
    }

    /**
     * 增加产品分类方法
     * @param pro_class
     * @return
     */
    @Override
    public Type addPro_Class(Pro_Class pro_class) {
        int count = productDao.addPro_Class(pro_class);

        if (count >= 1) {
            return new Type("success");
        }
        return new Type("error");
    }

    /**
     * 获取展示商品分类信息
     * @return
     */
    @Override
    public List<Pro_Class> getPro_classlist() {
        List<Pro_Class> list = productDao.getPro_class();
        return list;
    }
}
